const Koa = require("koa");
const Router = require("koa-router");
const { koaBody } = require("koa-body");
const cors = require("koa2-cors");
const path = require("path");

const uploadRouter = require('./service/upload')
const app = new Koa();


app.use(cors());
app.use(koaBody());

//对于任何请求，app将调用该异步函数处理请求
// app.use(async(ctx,next) => {
//     //将`Hello World`返回给浏览器
//     ctx.body='Hello World'
// })



app.use(uploadRouter.routes());
//监听3000端口
app.listen(3000,()=>console.log('服务端启动'+ "localhost:3000"))